package com.cedifie.lendapp.utils.event.room;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface CedEventDao {
    @Insert
    void insert(CedEvent event);

    @Query("SELECT * FROM ced_events WHERE isUpload = 0 ORDER BY timestamp ASC")
    List<CedEvent> getUnsentEvents();

    @Update
    void updateCedEvents(List<CedEvent> events);

    @Query("DELETE FROM ced_events WHERE isUpload = 1")
    void deleteCedUploadedEvents();
}
